import request from '@/utils/request'

export function del(deploymentId) {
  const params = {
    deploymentId: deploymentId
  }
  return request({
    url: 'flowProcess/delete',
    method: 'delete',
    params
  })
}
export function flowHangUp(procDefId, state) {
  const params = {
    procDefId: procDefId
  }
  return request({
    url: 'flowProcess/updateState/' + state,
    method: 'post',
    params
  })
}
export function transformModel(procDefId) {
  const params = {
    procDefId: procDefId
  }
  return request({
    url: 'flowProcess/transformModel',
    method: 'post',
    params
  })
}
export function resourceReadImg(procDefId, resType) {
  const params = {
    procDefId: procDefId,
    resType: resType
  }
  return request({
    url: 'flowProcess/resourceRead',
    method: 'get',
    responseType: 'arraybuffer',
    params
  })
}
export function resourceReadXml(procDefId, resType) {
  const params = {
    procDefId: procDefId,
    resType: resType
  }
  return request({
    url: 'flowProcess/resourceRead',
    method: 'get',
    params
  })
}
export function getImage(processDefinitionId, id) {
  return request({
    url: 'flowDiagram/getImage/' + processDefinitionId + '/' + id,
    method: 'get',
    responseType: 'arraybuffer'
  })
}
export function discard(processInstanceId, discardDescription) {
  const params = {
    discardDescription: discardDescription,
    procInsId: processInstanceId
  }
  return request({
    url: 'flowProcess/discard',
    method: 'post',
    params
  })
}
